package de.idgard.android.addon.backend.impl;

import de.idgard.json.transport.CacheHandler;
import de.idgard.webapp.shared.dto.bookmark.BookmarkFolderDto;

/**
 * 
 * @author ckaratza Caches and controls state of backend calls for faster access
 *         and less round trip calls.
 * 
 */

class BackendCacheManager implements CacheHandler {

	BackendCacheManager() {

	}

	public void setResponseObjectAndResolveActualTarget(Object obj) {
		if (obj instanceof BookmarkFolderDto) {
			setBookMarks((BookmarkFolderDto) obj);
		}
	}

	private BookmarkFolderDto bookmarkFolder;

	BookmarkFolderDto getBookMarks() {
		return bookmarkFolder;
	}

	private void setBookMarks(BookmarkFolderDto folder) {
		this.bookmarkFolder = folder;
	}

	void invalidateBookmarks() {
		this.setBookMarks(null);
	}
}
